##########################
### Table 2, Appendix ###
#########################

rm(list = ls());library(foreign)
install.packages("MSBVAR", dependencies=TRUE);library(MSBVAR)

d<-read.dta("Data.dta");head(d)

table2<-granger.test(d[,c(1,2,3,4,12)],4);table2

###########################
### Table 4-8, Appendix ###
###########################

head(d)
dtot<-d[,c(1:4,12)];d1<-d[,c(1:4,8)];d2<-d[,c(1:4,9)];d3<-d[,c(1:4,10)];d4<-d[,c(1:4,11)]

twitterTOT<-var.lag.specification(dtot, lagmax = 15);
table4<-var.lag.specification(dtot, lagmax = 15); table4

twitter1<-var.lag.specification(d1, lagmax = 15)
table5<-var.lag.specification(d1, lagmax = 15); table5

twitter2<-var.lag.specification(d2, lagmax = 15)
table6<-var.lag.specification(d2, lagmax = 15); table6

twitter3<-var.lag.specification(d3, lagmax = 15)
table7<-var.lag.specification(d3, lagmax = 15); table7

twitter4<-var.lag.specification(d4, lagmax = 15)
table8<-var.lag.specification(d4, lagmax = 15); table8